# _*_ coding:utf-8 _*_
# @author : Joyamon
# @time : 2023-1-9 15:35
# @file : conftest.py

import warnings
import pytest
import os
from common.read_yaml import read_data
from config.read_config import Config
from settings.settings import Route


# 屏蔽警告
@pytest.fixture(scope='session', autouse=True, name='warning')
def warning():
    warnings.simplefilter('ignore', DeprecationWarning)
    yield


# 读取测试用例文件
@pytest.fixture(scope='session', autouse=True, name='cases')
def detected_testcases():
    files = os.listdir(Route().testcases())
    yield files

# 获取token
@pytest.fixture(scope='session', autouse=True, name='token')
def get_token():
    response = Request().request(Route().testcases(filename='getToken.yaml'))
    token = response['result']['access_token']
    yield token
